package threadpool;

import java.util.concurrent.Executors;

/**
 * @Classname ForLoop
 * @Description 升级为使用for循环
 * @Date 2024/1/7 16:40
 * @Author zhuzhenguo
 */
public class ForLoop {
    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++) {
            Thread thread = new Thread(new Task());
            thread.start();
        }
    }

    /**
     * 任务,任务可以有无数个，线程数量是有上限的
     */
    static class Task implements Runnable {
        @Override
        public void run() {
            System.out.println("执行了任务");
        }
    }
}
